@extends('layouts.default')
@section('content')     
<div class="box">
    <header>
        <div class="icons">
            <i class="fa fa-table"></i>
        </div>
        <h5>{{ Lang::get('messages.in_fleet') }}</h5>
    </header>
    <div id="collapse4" class="body">
        <table id="dataTable" class="table table-bordered table-condensed table-hover table-striped">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>{{ Lang::get('messages.make') }}</th>
                    <th>{{ Lang::get('messages.model')}}</th>
                    <th>{{ Lang::get('messages.license')}}</th>
                    <th>{{ Lang::get('messages.milage')}}</th>                                   
                    <th>{{ Lang::get('messages.status')}}</th>                                   
                </tr>
            </thead>
            <tbody>                             
                @foreach ($result as $r)
                <tr>    
                    <td>{{ $r->id }}</td>                                  
                    <td>{{ link_to_action('CarController@show', $r->Make, $r->id)}}</td>  
                    <td>{{ $r->Model }}</td> 
                    <td>{{ $r->License }}</td>  
                    <td>{{ $r->Milage }}</td> 
                    <td>
                        @if ( Helpers\Helper::sum($r->sgs, $r->tpl, 
                        $r->kasko, $r->inter_permis, $date, $limit_date) == 0) 
                        <i class="fa fa-info-circle fa-lg" style="color:#006dcc" 
                           title="{{Lang::get('messages.empty_status_tltp') }}"></i>
                        
                        @elseif( Helpers\Helper::sum($r->sgs, $r->tpl, 
                        $r->kasko, $r->inter_permis, $date, $limit_date) >= 1
                        && (Helpers\Helper::sum($r->sgs, $r->tpl, $r->kasko, 
                        $r->inter_permis, $date, $limit_date) <= 4))
                        <i class="fa fa-check-circle fa-lg" style="color:#42b142" 
                           title="{{ Lang::get('messages.success_status_tltp') }}"></i>
                       
                        @elseif( Helpers\Helper::sum($r->sgs, $r->tpl, $r->kasko, 
                        $r->inter_permis, $date, $limit_date) >= 5 
                        && (Helpers\Helper::sum($r->sgs, $r->tpl, $r->kasko, 
                        $r->inter_permis, $date, $limit_date) <= 20)) 
                        <i class="fa fa-exclamation-circle fa-lg" style="color:#ec971f" 
                           title="{{Lang::get('messages.warning_status_tltp') }}"></i>
                        
                        @elseif( Helpers\Helper::sum($r->sgs, $r->tpl, $r->kasko, 
                        $r->inter_permis, $date, $limit_date) >= 21) 
                        <i class="fa fa-exclamation-circle fa-lg" style="color:#c00" 
                           title="{{Lang::get('messages.danger_status_tltp') }}"></i>
                        
                        @endif
                    </td> 
                </tr>                                                            
                @endforeach
            </tbody>
        </table>
    </div>
</div>       
@stop
